// '2020-9-10' '2020-10-3'
// 算两个日期之间的有效日期
// [2020-9-11,....]
function rangeDay (day1, day2) {
    const result = []
    const dayTimes = 24*60*60*1000
    const startTime = day1.getTime()
    const range = day2.getTime() - startTime
    let total = 0
    // 转换成ms算
    while (total <= range && range > 0) {
        console.log(total);
        result.push(new Date(startTime + total).toLocaleDateString().replace(/\//g, '-'))
        total += dayTimes
    }
    return result
 };
 
    rangeDay(new Date("2016-02-08"), new Date("2016-03-03"))
 
    console.log(rangeDay(new Date("2016-02-08"), new Date("2016-03-03")))
 
    // ["2018-12-1", "2018-12-2", "2018-12-3", "2018-12-4", "2018-12-5", "2018-12-6", "2018-12-7", "2018-12-8", "2018-12-9", "2018-12-10", "2018-12-11", "2018-12-12", "2018-12-13", "2018-12-14", "2018-12-15", "2018-12-16", "2018-12-17", "2018-12-18", "2018-12-19", "2018-12-20", "2018-12-21", "2018-12-22", "2018-12-23", "2018-12-24", "2018-12-25"]